Prevent duplicate entries in _SourceItemsToCopyToPublishDirectory*#52296
Prevent duplicate entries in _SourceItemsToCopyToPublishDirectory*#52296BrzVlad wants to merge 2 commits intodotnet:mainfrom
_SourceItemsToCopyToPublishDirectory*#52296Conversation
|
Not entirely sure if this is the right fix since I don't have experience in the area. Obviously this could also be fixed at the level of the ready to run command but handling it here seemed more appropriate. For a more detailed description of the issue and a simple repro see https://github.com/BrzVlad/repros/tree/main/composite-r2r-publish. Issue encountered while working on composite R2R configuration for BenchmarkDotNet. |
There was a problem hiding this comment.
Pull request overview
This PR adds duplicate prevention for _NoneWithTargetPath items when copying to the publish directory. The changes prevent duplicate entries that can occur when items exist in both child projects and the current project, which would later cause crossgen2 to fail when it receives duplicate assembly inputs.
Key changes:
- Add
KeepDuplicatesattribute to three_NoneWithTargetPathItemGroup declarations - Use the existing
_GCTPDIKeepDuplicatesproperty (set tofalse) to control deduplication behavior - Follow the same pattern already applied to child project items from
_AllChildProjectPublishItemsWithTargetPath
src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Publish.targets
Outdated
Show resolved
Hide resolved
We can end up with duplicated items if they exist both in child projects as well as in the current project that we are building. These end up added to `ResolvedFileToPublish` and later on passed to crossgen2, which doesn't accept duplicate assembly inputs.
7aef25e to
cb0c514
Compare
vitek-karas
left a comment
There was a problem hiding this comment.
Looks good to me - but let's also get review from Sven or somebody else from the trimmer/NativeAOT
We can end up with duplicated items if they exist both in child projects as well as in the current project that we are building. These end up added to
ResolvedFileToPublishand later on passed to crossgen2, which doesn't accept duplicate assembly inputs.